using System;
using System.Threading;
using System.Web.UI;

namespace ScottCateAjax2008.UserControls
{
    public partial class TimeLabelButton : UserControl
    {
        private bool delayLoad;
        public bool DelayLoad
        {
            get { return delayLoad; }
            set { delayLoad = value; }
        }

        private int secondsToDelay = 2;
        public int SecondsToDelay
        {
            get { return secondsToDelay; }
            set 
            {
                delayLoad = true;
                secondsToDelay = value; 
            }
        }

        protected void Page_Load ( object sender, EventArgs e )
        {
            if(DelayLoad)
                Thread.Sleep( secondsToDelay * 1000);
            SetTimeLabel();
        }

        private void SetTimeLabel()
        {
            TimeLabel.Text = DateTime.Now.ToLongTimeString();
        }
    }
}









